package org.fu.crowd.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *      Filter、Interceptor 几乎相同的功能
 *      1. Filter是servlet原生定义的。脱离spring也能使用
 *      2. Interceptor是spring定义的接口。可以使用spring的自动注入
 */
//@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //登录拦截
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/","/register","/saveRegister",
                        "/member/login","/member/logout","/member/doLogin",
                        "/register/getPhoneCode","/bootstrap/**","/css/**",
                        "/crowd/**","/fonts/**","/img/**","/jquery/**"
                        ,"/layer/**","/script/**","/ztree/**");

    }
}
